<!--************************************************************ -->
<!--* 文件创建日期：2010                                  * -->
<!--* 文件修改日期：			                                   * -->
<!--************************************************************ -->
<!--JSP初始化设置-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.infomanage.po.*" %>
<%@page import="com.infomanage.vo.*" %>
<%@page import="com.infomanage.service.tech.*"%>
<%  response.addDateHeader("Expires", 0);response.setHeader("Pragma","no-cache"); response.setHeader("Cache-Control","no-cache");%>
<%
	request.setCharacterEncoding("UTF-8");
	String itemId = request.getParameter("itemId");
    if(itemId == null) itemId = "";
    
    TechExchangeItem item = TechExchangeService.loadTechExchange(request, response, out);
    int  acceptOndutyPersonId = -1;
    String  acceptSuggest = "";
    int  acceptXdPersonNum = 0;
    int  acceptXdzId = -1;
    int  acceptZdzId = -1;
    String confirm = "";
    String confirmSign = "";
    int deliOndutyPersonId = -1;
    String deliSuggest = "";
    int deliXdPersonNum = 0;
    int deliXdzId = -1;
    int deliZdzId = -1;
    String problem = "";
    String problemSign = "";
    String acceptOndutyPersonName = "";
    String acceptXdzName = "";
    String acceptZdzName = "";
    String deliOndutyPersonName = "";
    String deliXdzName = "";
    String deliZdzName = "";
    if(item != null) {
			TechExchange bean = item.getBean();
			Person acceptOndutyPerson = item.getAcceptOndutyPerson();
			Person acceptXdz = item.getAcceptXdz();
			Person acceptZdz = item.getAcceptZdz();
			Person deliOndutyPerson = item.getDeliOndutyPerson();
			Person deliXdz = item.getDeliXdz();
			Person deliZdz = item.getDeliZdz();
			acceptOndutyPersonId = bean.getAcceptOndutyPerson();
			acceptSuggest = bean.getAcceptSuggest();
			acceptXdPersonNum = bean.getAcceptXdPersonNum();
			acceptXdzId = bean.getAcceptXdzId();
			acceptZdzId = bean.getAcceptZdzId();
			confirm = bean.getConfirm();
			confirmSign = bean.getConfirmSign();
			deliOndutyPersonId = bean.getDeliOndutyPerson();
			deliSuggest = bean.getDeliSuggest();
			deliXdPersonNum = bean.getDeliXdPersonNum();
			deliXdzId = bean.getDeliXdzId();
			deliZdzId = bean.getDeliZdzId();
			problem = bean.getProblem();
			problemSign = bean.getProblemSign();
			acceptOndutyPersonName = acceptOndutyPerson.getName();
			acceptXdzName = acceptXdz.getName();
			acceptZdzName = acceptZdz.getName();
			deliOndutyPersonName = deliOndutyPerson.getName();
			deliXdzName = deliXdz.getName();
			deliZdzName = deliZdz.getName();
    } 
%>
<html>
<head>
	<title>交接班记录</title>
	<META HTTP-EQUIV="Pragma" CONTENT="no-cache">	
	<link href="../../css/table.css" rel="stylesheet" type="text/css">
	<link href="../../css/calendar.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="../../js/calendar.js"></script>
	<script type="text/javascript" src="../../js/common.js"></script>
	<script type="text/javascript">
	   function init() {
		   if("" != "<%=itemId%>") { // 修改
		   }
	   }
	   // 提交
	   function doSubmit(){
	   		if(validate()){
	   			return;	
	   		}
		 	if("" == "<%=itemId%>") {
		 		form1.actionType.value = "add";
			}else {
		 		form1.actionType.value = "modify";
			}
		 	form1.submit();
	   }

	   function showError(error){
		   alert(error);
	   }

	   function showInfo(info){
		   alert(info);
		   window.returnValue = "ok";
		   window.close();
	   }
	   
	   function validate(){
	   		if(form1.deliXdzId.value == -1){
	   			alert("（交班）小队长不能为空！");
	   			return true;
	   		}
	   		if(form1.deliZdzId.value == -1){
	   			alert("（交班）值班中队长不能为空！");
	   			return true;
	   		}
	   		if(form1.deliOndutyPerson.value == -1){
	   			alert("（交班）电话值班员不能为空！");
	   			return true;
	   		}
	   		
	   		if(form1.acceptXdzId.value == -1){
	   			alert("（接班）小队长不能为空！");
	   			return true;
	   		}
	   		if(form1.acceptZdzId.value == -1){
	   			alert("（接班）值班中队长不能为空！");
	   			return true;
	   		}
	   		if(form1.acceptOndutyPerson.value == -1){
	   			alert("（接班）电话值班员不能为空！");
	   			return true;
	   		}
	   		
	   		if(isNaN(form1.deliXdPersonNum.value)){
	   			alert("（交班）小队人数必须为数字！");
	   			return true;
	   		}
	   		
	   		if(isNaN(form1.acceptXdPersonNum.value)){
	   			alert("（接班）小队人数必须为数字！");
	   			return true;
	   		}
	   		
	   		if(form1.problem.value.length > 5000){
   				alert("值班队工作情况及存在问题不能超过5000个字！");
   				return true;
	   	    }
	   	    
	   		if(form1.deliSuggest.value.length > 5000){
   				alert("值班中队长意见不能超过5000个字！");
   				return true;
	   	    }
	   	    
	   		if(form1.confirm.value.length > 5000){
   				alert("接班队装备等确认情况不能超过5000个字！");
   				return true;
	   	    }
	   	    
	   		if(form1.acceptSuggest.value.length > 5000){
   				alert("值班中队长意见不能超过5000个字！");
   				return true;
	   	    }
	   		return false;
	   }
	</script>
</head>
<body  rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" onclick="clickBody();" onload="init();">
	<form name="form1" action="exchange_action.jsp" method="post" target="actionFrame">
	<input type="hidden" name="itemId" value="<%=itemId%>">
	<input type="hidden" name="actionType">
	<table class="dialogTable" cellpadding="0" cellspacing="0">
		<!-- 表头-->
		<tr class="dialogTableHeader">
			<td>交接班记录</td>
		</tr>
		<!-- 表数据-->
		<tr class="dialogTableContent">
			<td>
				<!-- 数据项 -->
				<table class="dataTable">
					<col width="10%">
					<col width="22%">
					<col width="23%">
					<col width="22%">
					<col width="23%">
					<tr>
						<td class="field" align="center">
							队别
						</td>
						<td class="field"  align="center">
							小队长
						</td>
						<td class="field"  align="center">
							值班中队长
						</td>
						<td class="field"  align="center">
							小队人数
						</td>
						<td class="field"  align="center">
							电话值班员
						</td>
					</tr>
					<tr>
						<td class="field">
							交班小队
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '../common/personTree.jsp');" treeSelect="true" treeType="1">
								<input name="deliXdzName" nodeId="" id="deptTreeInput" value="<%=deliXdzName %>" 
									style="width: 149px;" readonly="readonly" 
									treeSelect="true"><input name="deliXdzId" value="<%=deliXdzId %>" type="hidden">
							</span>
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '../common/personTree.jsp');" treeSelect="true" treeType="1">
								<input name="deliZdzName" nodeId="" id="deptTreeInput" value="<%=deliZdzName %>" 
									style="width: 158px;" readonly="readonly" 
									treeSelect="true"><input name="deliZdzId" value="<%=deliZdzId %>" type="hidden">
							</span>
						</td>
						<td>
							<input name="deliXdPersonNum"  value="<%=deliXdPersonNum %>">
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '../common/personTree.jsp');" treeSelect="true" treeType="1">
								<input name="deliOndutyPersonName" nodeId="" id="deptTreeInput" value="<%=deliOndutyPersonName %>" 
									style="width: 158px;" readonly="readonly" 
									treeSelect="true"><input name="deliOndutyPerson" value="<%=deliOndutyPersonId %>" type="hidden">
							</span>
						</td>
					</tr>
					<tr>
						<td class="field">
							接班小队
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '../common/personTree.jsp');" treeSelect="true" treeType="1">
								<input name="acceptXdzName" nodeId="" id="deptTreeInput" value="<%=acceptXdzName %>" 
									style="width: 149px;" readonly="readonly" 
									treeSelect="true"><input name="acceptXdzId" value="<%=acceptXdzId %>" type="hidden">
							</span>
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '../common/personTree.jsp');" treeSelect="true" treeType="1">
								<input name="acceptZdzName" nodeId="" id="deptTreeInput" value="<%= acceptZdzName%>" 
									style="width: 158px;" readonly="readonly" 
									treeSelect="true"><input name="acceptZdzId" value="<%=acceptZdzId %>" type="hidden">
							</span>
						</td>
						<td>
							<input name="acceptXdPersonNum"   value="<%= acceptXdPersonNum%>">
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '../common/personTree.jsp');" treeSelect="true" treeType="1">
								<input name="acceptOndutyPersonName" nodeId="" id="deptTreeInput" value="<%= acceptOndutyPersonName%>" 
									style="width: 158px;" readonly="readonly" 
									treeSelect="true"><input name="acceptOndutyPerson" value="<%= acceptOndutyPersonId%>" type="hidden">
							</span>
						</td>
					</tr>
					<tr>
						<td class="field">
							值班队工作情况及存在问题
						</td>
						<td height="100px" colspan="4">
							<textarea style="height: 100%;width: 100%;" name="problem"><%=problem%></textarea>
						</td>
					</tr>
					<tr>
						<td class="field">
							值班中队长意见
						</td>
						<td height="60px" colspan="4">
							<textarea style="height: 100%;width: 100%;" name="deliSuggest"><%=deliSuggest %></textarea>
						</td>
					</tr>
					<tr>
						<td class="field">
							接班队装备等确认情况 
						</td>
						<td height="100px" colspan="4">
							<textarea style="height: 100%;width: 100%;" name=confirm><%=confirm %></textarea>
						</td>
					</tr>
					<tr>
						<td class="field">
							值班中队长意见
						</td>
						<td height="60px" colspan="4">
							<textarea style="height: 100%;width: 100%;" name="acceptSuggest"><%=acceptSuggest %></textarea>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="tableBtn">
				<span onclick="doSubmit();">确定</span>
				<span onclick="window.close();">取消</span>
			</td>
		</tr>
		<tr valign="top">
			<td colspan="2">
				&nbsp;
			</td>
		</tr>
	</table>
	</form>
	<iframe src="#" frameborder="0" id="treeFrame" name="frame" style="display: none;position: absolute;"></iframe>
	<iframe src="#" name="actionFrame" style="display: none;"></iframe>
</body>
</html>